Optimizing space management of tablespaces in database systems

ABSTRACT

A database is identified, wherein the database has two or more tablespaces. A local partition and a global partition for each tablespace of the two or more tablespaces is created, wherein the created two or more global partitions are included in a global storage pool. A request to move an object to a first local partition of a first tablespace of the two or more tablespaces is received. That an amount of used space of the first local partition is above a first threshold is determined. Responsive to determining that the amount of used space of the first local partition is above the first threshold, at least a portion of the object is stored in the global storage pool.

BACKGROUND OF THE INVENTION

The present invention relates generally to the field of databases, andmore particularly to optimizing space management of tablespaces indatabase systems.

Databases are computerized information storage and retrieval systems. ARelational Database Management System (RDBMS) is a database managementsystem (DBMS) which uses relational techniques for storing andretrieving data. Relational databases are organized into tables whichconsist of rows and columns of data. The rows are formally called tuplesor records. A database will typically have many tables, and each tablewill typically have multiple tuples and multiple columns. Tables areassigned to tablespaces.

A tablespace is a storage location, such as on a direct access storagedevice (i.e., magnetic or optical disk drives for semi-permanentstorage), where the actual data underlying a database object is kept. Itprovides a layer of abstraction between physical and logical data andserves to allocate storage for all DBMS managed segments. The tablespaceis a collection of storage containers (e.g., files) used to store datafor database objects (e.g., relational tables).

SUMMARY

Embodiments of the present invention include a method, computer programproduct, and system for optimizing free space in a database. In oneembodiment, a database is identified, wherein the database has two ormore tablespaces. A local partition and a global partition of the two ormore tablespaces is created, wherein the created two or more globalpartitions are included in a global storage pool. A request to move anobject to a first local partition of a first tablespace of the two ormore tablespaces is received. That an amount of used space of the firstlocal partition is above a first threshold is determined. Responsive todetermining that the amount of used space of the first local partitionis above the first threshold, at least a portion of the object is storedin the global storage pool.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a functional block diagram of a data processing environment,in accordance with an embodiment of the present invention;

FIG. 2 is a flowchart depicting operational steps for optimizing freespace in a database, in accordance with an embodiment of the presentinvention;

FIG. 3 depicts a block diagram of components of the computer of FIG. 1,in accordance with an embodiment of the present invention.

DETAILED DESCRIPTION

Embodiments of the present invention provide a flexible, automated,intelligent and smart database management system (DBMS). Embodiments ofthe present invention provide for the splitting of tablespaces in adatabase into two separate partitions. The first, local partition,provides for storing objects local to the tablespace the partition isassociated with. The second, global partition, provides for storingobjects local to other tablespaces in the same database that thepartition is not associated with.

Embodiments of the present invention recognize that databaseadministrators can spend a large amount of time, up to 50 percent,managing database space and ensuring that sufficient space is availableto support the growth of business, recoverability requirements ordisaster recovery system availability and currency of the criticalapplications and databases. Embodiments of the present inventionrecognize that a large percentage, up to 40 percent, of business outagesare linked to dataspace management related issues. Often, database spaceallocation is very much skewed. The space is distributed within adatabase to different tablespaces, and each tablespace manages its ownspace independently. This leads to a situation in which one of thetablespaces becomes full and causes objects within the tablespace to beunable to extend which causes outages, and business processing comes toa halt even though there is sufficient free space in other tablespaceswithin the database. Embodiments of the present invention avoid skewedspace distribution inside the database, avoid outages due to free spacebeing used due to an abnormally high rate of space consumption by aprocess, avoid outages due to monitoring failures, avoid outages due todelay in human intervention/human errors, and provide additionalmonitoring at no extra cost.

Embodiments of the present invention allow for the sharing of spacebetween different tablespaces in the same database. Embodiments of thepresent invention allow for dynamically borrowing and lending of spacebetween partitions of tablespaces. Embodiments of the present inventionprovide algorithms to identify suitable candidate global partitions froma list of potential global partitions that will provide needed storagespace to local partitions facing capacity threats. Embodiments of thepresent invention provide algorithms to optimize writing back data fromglobal partitions to their parent local partition upon the localpartition having enough free space to provide for the data. Embodimentsof the present invention provide modules for keeping track of the spaceutilization in database tablespaces, including their local partition andglobal partition. Embodiments of the present invention providemechanisms to avoid outages due to skewed space distribution indifferent database tablespaces or compartments. Embodiments of thepresent invention provide options to configure, enable, or disable thecapacity management features and thresholds for databases, tablespacesor partitions, both individually and globally for all databases,tablespaces or partitions.

The present invention will now be described in detail with reference tothe Figures. FIG. 1 is a functional block diagram illustrating a dataprocessing environment, generally designated 100, in accordance with oneembodiment of the present invention. FIG. 1 provides only anillustration of one implementation and does not imply any limitationswith regard to the systems and environments in which differentembodiments can be implemented. Many modifications to the depictedembodiment can be made by those skilled in the art without departingfrom the scope of the invention as recited by the claims.

An embodiment of data processing environment 100 includes computer 110,interconnected over network 102. Network 102 can be, for example, alocal area network (LAN), a telecommunications network, a wide areanetwork (WAN) such as the Internet, or any combination of the three, andinclude wired, wireless, or fiber optic connections. In general, network102 can be any combination of connections and protocols that willsupport communications between computer 110 and any other computerconnected to network 102, in accordance with embodiments of the presentinvention.

In example embodiments, computer 110 can be a laptop, tablet, or netbookpersonal computer (PC), a desktop computer, a personal digital assistant(PDA), a smart phone, or any programmable electronic device capable ofcommunicating with any computing device within data processingenvironment 100. In certain embodiments, computer 110 collectivelyrepresents a computer system utilizing clustered computers andcomponents (e.g., database server computers, application servercomputers, etc.) that act as a single pool of seamless resources whenaccessed by elements of data processing environment 100, such as in acloud computing environment. In general, computer 110 is representativeof any electronic device or combination of electronic devices capable ofexecuting computer readable program instructions. Computer 110 caninclude components as depicted and described in further detail withrespect to FIG. 3, in accordance with embodiments of the presentinvention.

Computer 110 includes database 120 and database management program (DMP)130. DMP 130 is a program, application, or subprogram of a largerprogram that optimizes free space in database 120 by cross-tablespaceblock allocations using bitmaps. Database 120 stores information in astructured manner on computer 110.

Database 120 resides on computer 110. In an alternative embodiment,database 120 can reside on another device or computer within dataprocessing environment 100 or any other device not within dataprocessing environment, accessible via network 102. A database is anorganized collection of data. Data found in a database is typicallyorganized to model relevant aspects of reality in a way that supportsprocesses requiring the information found in the database. Database 120can be implemented with any type of storage device capable of storingdata that can be accessed and utilized by computer 110, such as adatabase server, a hard disk drive, or a flash memory. In otherembodiments, database 120 can be implemented with multiple storagedevices within computer 110.

Alternatively, database 120 can be implemented with any computerreadable storage medium as found in the art. For example, the computerreadable storage medium can be a tangible device that can retain andstore instructions for use by an instruction execution device. Thecomputer readable storage medium can be, for example, but is not limitedto, an electronic storage device, a magnetic storage device, an opticalstorage device, an electromagnetic storage device, a semiconductorstorage device, or any suitable combination of the foregoing. Anon-exhaustive list of more specific examples of the computer readablestorage medium includes the following: a portable computer diskette, ahard disk, a random access memory (RAM), a read-only memory (ROM), anerasable programmable read-only memory (EPROM or Flash memory), a staticrandom access memory (SRAM), a portable compact disc read-only memory(CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk,a mechanically encoded device such as punch-cards or raised structuresin a groove having instructions recorded thereon, and any suitablecombination of the foregoing.

Database 120 includes database dictionary 122, database table 124,tablespace 140 a, and tablespace 140 b. In an alternative embodiment,database 120 can include any number of tablespaces of any size. Databasedictionary 122 includes a summary of all space allocated and spaceavailable in all of the tablespaces found in the database. Databasetable 124 includes all information regarding transformation of data andthe usage of space between tablespaces and can also be used whilechecking for interdependencies between tablespaces during databaseoperations like export, backup, and restore at the tablespace levels.Tablespaces 140 a and 140 b are storage locations in database 120 whereobjects are kept. An object is a location in memory having a value andpossibly referenced by an identifier. An object can be a variable, adata structure, or a function. In the class-based object-orientedprogramming paradigm, an object can be referred to as a particularinstance of a class where the object can be a combination of variables,functions, and data structures. In a relation database managementsystem, an object can be a table or column, or an association betweendata and a database entity. Tablespace 140 a includes local partition150 a, local bitmap 152 a, global partition 154 a, and global bitmap 156a.

Tablespace 140 a is split into two distinct sections, a local partition150 a and a global partition 154 a. In other words, each tablespace hasa local partition and a global partition. The size of each of thesepartitions is a configurable parameter that is indicated by a user ofDMP 130 upon setup of database 120 and can be changed by the user or DMP130 due to the needs and requirements of database 120. The storage spaceof local partition 150 a is allocated only to local objects, in otherwords, objects that are assigned to be stored in tablespace 140 a. Thisis similar to existing uses of database systems. The storage space ofglobal partition 154 a is allocated to objects belonging to the sametablespace (i.e., tablespace 140 a) or another tablespace (e.g.,tablespace 140 b) in the same database. The storage space of globalpartition 154 a can be used by another tablespace when the localpartition of the other tablespace is not sufficient for the storageneeds of that tablespace. DMP 130 maintains two separate bitmaps, localbitmap 152 a for local partition 150 a and global bitmap 156 a forglobal partition 154 a. Local bitmap 152 a contains informationregarding the space allocation of objects found in local partition 150a. Additionally, local bitmap 152 a maintains a list of free blocks inlocal partition 150 a and percent of space used and percent of freespace of local partition 150 a. Global bitmap 156 a contains informationregarding the space allocation of objects found in global partition 154a. Additionally, global bitmap 156 a maintains a list of free blocks inthe global partition 154 a and percent of space used and percent of freespace of global partition 154 a. The information found in local bitmap152 a and global bitmap 156 a regarding free blocks, percent of spaceused and percent of free space in local partition 150 a and globalpartition 154 a is shared with database dictionary 122, discussedpreviously. In an embodiment, local bitmap 152 a and global bitmap 156 aare stored in the file headers of tablespace 140 a.

Tablespace 140 b includes local partition 150 b, similar to localpartition 150 a, discussed previously. Tablespace 140 b includes localbitmap 152 b, similar to local bitmap 152 a, discussed previously.Tablespace 140 b includes global partition 154 b, similar to globalpartition 154 a, discussed previously. Tablespace 140 b includes globalbitmap 156 b, similar to global bitmap 156 a, discussed previously.

Database dictionary 122 includes at least one of the following tables.First, chained_tablespaces is a table that contains information on thechained tablespaces or tablespaces that are working together. This tableis maintained and periodically updated by DMP 130. Second,candidate_supplier_tablespaces is a table that stores information aboutthe tablespaces that have free space in their global partition that islarge enough to be allocated to other tablespaces to fulfill theircapacity issues. The global partitions that have free space in theirglobal partitions that is large enough to be allocated to othertablespaces is also known as the global storage pool. Third,resized_partition_tablespace is a table that stores information aboutthe tablespaces that have their local and global partitions resized tomeet higher space requirements of objects belonging to the sametablespace.

Additionally, database dictionary 122 will include the percent used andpercent free thresholds for each local partition in each tablespace, thepercent used and percent free thresholds for each global partition, thefree space threshold for every tablespace, and the percent of atablespace that is eligible to be shared. The percent used and percentfree threshold for each local partition (PCTUL/PCTFL) in each tablespaceis used by DMP 130 to determine when space is becoming exhausted in aparticular local partition, and the space allocation process will startexpanding the local partition of the tablespace by using the free spacein the global partition of the same tablespace. The percent used andpercent free threshold for each global partition (PCTUG/PCTFG) in eachtablespace is used by DMP 130 to determine when space is becomingexhausted in a particular global partition, and the space allocationprocess will start looking for candidate tablespaces that have globalpartitions with free sufficient space. The percent free space thresholdfor every tablespace is used by DMP 130 to determine when there isenough free space in a tablespace to reclaim data that is being storedin the global partition of another tablespace and move the informationto the local partition or global partition of the original tablespacewhere the information was supposed to be located. The percent of atablespace that is eligible to be shared is the percentage of tablespacethat can be made into the global partition of that tablespace andallowed to be shared with other tablespaces should they have capacityissues. In an embodiment, the thresholds can apply to all tablespacesand partitions in the database. In an alternative embodiment, individualtablespaces and individual partitions can have different thresholds.

DMP 130 optimizes the free space in database 120. DMP 130 determines adatabase, tablespaces, and partitions to manage. In an embodiment, theuser, using a user interface discussed below, indicates to DMP 130 whichdatabase, tablespaces, and partitions to manage. In an alternativeembodiment, DMP 130 searches computer 110 or any other computerconnected to computer 110 via network 102, and a user, via userinterface discussed below, can choose the database, tablespaces, andpartitions to manage. In an embodiment, DMP 130 can move data andobjects into and out of tablespaces and partitions of the tablespaces(i.e., add or delete data or objects). DMP 130 monitors the database anddetermines if there is a capacity threat to any of the tablespaces orpartitions of the tablespaces. If there is a capacity threat to any ofthe tablespaces, DMP 130 identifies the space requirement to overcomethe capacity threat and then determines global partitions of othertablespaces that can provide the needed capacity to overcome the threat.DMP 130 then moves the data from the tablespace with the capacity to thedetermined global partitions of other tablespaces and updates thedatabase. If there is no capacity threat to any of the tablespaces, DMP130 determines if any of the local partitions have a percent free ofspace that is above a threshold. If it is not determined that there is alocal partition that has a percent free of space that is above athreshold, DMP 130 continues to monitor the database. If it isdetermined that there is a local partition that has a percent free ofspace that is above a threshold, DMP 130 determines the information toreclaim from global partitions to the local partition and then updatesthe database for any actions that occur.

A user interface (not shown) is a program that provides an interfacebetween a user and DMP 130. A user interface refers to the information(such as graphic, text, and sound) a program presents to a user and thecontrol sequences the user employs to control the program. There aremany types of user interfaces. In one embodiment, the user interface canbe a graphical user interface (GUI). A GUI is a type of user interfacethat allows users to interact with electronic devices, such as akeyboard and mouse, through graphical icons and visual indicators, suchas secondary notations, as opposed to text-based interfaces, typedcommand labels, or text navigation. In computer, GUIs were introduced inreaction to the perceived steep learning curve of command-lineinterfaces, which required commands to be typed on the keyboard. Theactions in GUIs are often performed through direct manipulation of thegraphics elements.

FIG. 2 is a flowchart of workflow 200 depicting operational steps foroptimizing free space in a database, in accordance with an embodiment ofthe present invention. In one embodiment, the steps of the workflow areperformed by DMP 130. Alternatively, steps of the workflow can beperformed by any other program while working with DMP 130. In anembodiment, DMP 130 can invoke workflow 200 upon receiving a request tomonitor database 120 which includes tablespace 140 a and 140 b includingtheir respective partitions. In an alternative embodiment, DMP 130 caninvoke workflow 200 upon the initialization, setup, or creation ofdatabase 120 including the creating of tablespace 140 a and 140 bincluding their respective partitions. A user, via the user interfacediscussed previously, can change, edit or modify any aspects ofdatabases, tablespaces, partitions, bitmaps, database dictionaries, ordatabase tables at any time or during any step of workflow 200.

For example, a user can change any of the thresholds. In yet anotherexample, the user can expand the size of the database to include moretablespaces. In even yet another example, a program can add free spaceto a tablespace and DMP 130 can distribute the free space between thelocal partition and global partition using at least one or more of thefollowing factors: amount of space added, thresholds set for the size ofpartitions in a database, percent of space utilized currently, rate ofspace being used in the partitions. Alternatively, the user can bypassDMP 130 and allocate the free space any way the user chooses.

DMP 130 determines database, tablespaces and partitions (step S205). DMP130 receives a request from a user, via the user interface discussedpreviously, or from another program to monitor at least one database.For example, DMP 130 can monitor database 120. In an alternativeembodiment, DMP 130 can monitor more than one database on computer 110.In yet another embodiment, DMP 130 can monitor one or more databasesaccessible via network 102. The request can be to monitor alltablespaces in a database. For example, DMP 130 can monitor tablespace140 a and 140 b. In an alternative embodiment, the request can be tomonitor some tablespaces in a database but not all tablespaces. In anembodiment, the size of the tablespaces can be predetermined based onthe previous utilization of the database. In an alternative embodiment,a user, via the user interface discussed previously, can modify the sizeof the tablespaces.

In an embodiment, the database can already have tablespaces with localand global partitions and their associated bitmaps. For example,tablespace 140 a includes local partition 150 a, local bitmap 152 a,global partition 154 a, and global bitmap 156 a, and tablespace 140 bincludes local partition 150 b, local bitmap 152 b, global partition 154b, and global bitmap 156 b. In an alternative embodiment, the databasecan only include tablespaces, and DMP 130 creates a local partition,local bitmap, global partition, and global bitmap for each tablespace inthe database. In an embodiment, DMP 130 can modify the sizes of thelocal partitions and global partitions depending on user input or basedon the space requirement and consumption rate of objects belonging intablespace.

In an embodiment, DMP 130 will also determine a database dictionary anddatabase table for the database. For example, database dictionary 122and database table 124 found in database 120. In an embodiment, databasedictionary 122 and database table 124 are already created and associatedwith database 120. In an alternative embodiment, upon DMP 130 creating alocal partition, local bitmap, global partition, and global bitmap foreach tablespace in the database, DMP can also create database dictionary122 and database table 124 using information associated with database120 or using information input by a user, via the user interfacediscussed previously. Database dictionary 122 can include informationabout which tablespaces (e.g., tablespace 140 a and 140 b) that are inthe same database (e.g., database 120) and work together sharing globalpartitions (e.g., global partition 154 a and 154 b) to optimize freespace in the database. Database dictionary 122 can include informationabout which tablespaces have free space in their global partition thatis large enough to be allocated to other tablespaces to fulfill theircapacity issues. For example, database 120 includes global partition 154a which is indicated in database dictionary 122 as having sufficientfree space to be allocated to tablespace 140 b to fulfill the capacityissues of local partition 150 b. Database dictionary 122 can includeinformation about tablespaces that have their local and globalpartitions resized to meet higher space requirement of objects belongingto the same tablespace. For example, if tablespace 140 a required theresizing of local partition 150 a to fulfill the size requirements of anobject to be stored in the tablespace, then it would be recorded indatabase dictionary 122. Database table 124 includes information aboutdata that has been stored in a global partition of another tablespacedue to the local partition of the tablespace the data was supposed to bestored in reaching capacity. For example, database table 124 couldrecord that an object that was initially to be stored on local partition150 b of tablespace 140 b but was stored in global partition 154 a oftablespace 140 a due to capacity issues in local partition 150 b.

In an embodiment, DMP 130 will also update the database dictionary 122for the thresholds. The thresholds, discussed previously, are thePCTUG/PCTFG, PCTUL/PCTFL, and free space threshold for every tablespacein database 120. In an embodiment, the thresholds are already associatedwith database 120 when DMP 130 receives monitory authority for thedatabase. The thresholds are then incorporated into database dictionary122 or can already be included in database dictionary. In an alternativeembodiment, a user, via the user interface discussed previously, canindicate the thresholds and DMP 130 records this information in databasedictionary 122.

DMP 130 monitors database 120 (step S210). In other words, DMP 130monitors all objects being stored in all tablespaces found in database120 and any changes that are made to the objects being stored in thetablespaces found in database 120. For example, DMP 130 monitors localpartition 150 a and global partition 154 a of tablespace 140 a and localpartition 150 b and global partition 154 b of tablespace 140 b. If anobject is stored in local partition 150 a, then DMP 130 updates localbitmap 152 a along with database dictionary 122 and database table 124entries about local partition 150 a. When DMP 130 determines that thepercent of space used of local partition 150 a is above the PCTUL oflocal partition 150 a, the local partition 150 a of tablespace 140 a issupplemented using the free space of global partition 154 a oftablespace 140 a. In other words, DMP 130 can now store at least aportion of the objects that were going to be stored in local partition150 a of tablespace 140 in the global partition 154 a of tablespace 140a if the percent used of global partition 154 a is below the threshold.A portion of the object may be stored in local partition 150 a oftablespace 140. The free space of global partition 154 a is determinedusing global bitmap 156 a. DMP 130 calculates the optimal size of freespace of global partition 154 a to be migrated and used instead of localpartition 150 a using one or more of the following: percent free spaceof global partition, size of tablespace the local and global partitionsare found in, size of global partition, size of local partition, andrate of growth of the tablespace. Rate of growth of the tablespaceindicates how fast the percentage of free space is being utilized in thelocal partition. Rate of growth of the tablespace is the rate at whichthe local partition in the tablespace is being filled with new data orobject being stored in the tablespace or when existing data or objectsin a tablespace are modified and the modified data or objects occupymore space as compared to the original data or object. DMP 130 updatesdatabase dictionary 122 and database table 124 for any changes to thesizes of local partition 150 a or global partition 154 a.

DMP 130 determines if there is a capacity threat (decision block S215).DMP 130 determines if any of the tablespaces in database 120 have apercent free space less than the threshold for the particulartablespace. For example, tablespace 140 a can have a percent freethreshold, as found in database dictionary 122, of twenty percent. DMP130 compares the percent free space of tablespace 140 a to the thresholdof twenty percent. For example, if tablespace 140 a has a nineteenpercent free space then DMP 130 determines that this is below thethreshold of twenty percent, and therefore there is a capacity threat.

If DMP 130 determines there is a capacity threat (decision block S215,yes branch), DMP 130 identifies the space requirement for the overloadinformation (step S220). In other words, DMP 130 determines what objectsare trying to be stored on the tablespace that has a capacity threat,and then DMP 130 determines the size of space needed to satisfy the sizerequirements of the objects to be stored and any potential objects thatare needed to be stored on the tablespace. The size of space needed tosatisfy the size requirements of the object to be stored and anypotential objects that are needed to be stored on the tablespace can bedetermined using at least one or more of the following: businessrequirement of the application, application specific architectdecisions, size of tablespace, free space available in tablespace, sizeof local and global partitions, free space available in local and globalpartitions, and growth predictions.

DMP 130 determines global partition(s) and moves the information (stepS225). In other words, DMP 130 determines which global partition(s) willbe used to solve the capacity threat determined previously. In anembodiment, DMP 130 can determine a single global partition in anothertablespace to solve the capacity threat. For example, if tablespace 140a has a capacity threat then global partition 154 b can be determined tosolve that capacity threat. In an alternative embodiment, DMP 130 candetermine more than one global partition in another tablespace to solvethe capacity threat.

DMP 130 determines the global partition(s) to be used to solve thecapacity threat based on at least one or more of the following factors:percent space used in the tablespaces, size of the tablespaces, size ofthe global partition in the tablespaces, space requirement for theoverload information, the percent of a tablespace that is eligible to beshared, and size of local partition in the tablespaces. A user, via userinterface discussed previously, at the beginning of monitoring adatabase or at any time during the monitoring of a database can indicateto DMP 130 which factors to weight more or less heavily for determiningthe global partition(s) or can indicate certain factors not to considerat all. DMP 130 then determines the optimal global partition(s) to beused to solve the capacity threat.

Based on the determined optimal global partition(s) to be used to solvethe capacity threat, at least a portion of the overload information isthen stored in those determined optimal global partition(s). The globalbitmap(s) for the global partition(s) are also updated accordingly. Forexample, if it is determined that tablespace 140 a has a capacitythreat, and it is also determined that global partition 154 b oftablespace 140 b is the optimal global partition to remedy that capacitythreat, then the overload information is stored in global partition 154b of tablespace 140 b, and global bitmap 156 b is updated accordingly.In an embodiment, DMP 130 can also indicate to store any new informationthat is supposed to be stored in the tablespace with the capacity threatin the determined optimal global partition(s). In an embodiment, aportion of the object may be stored in local partition 150 a oftablespace 140 a.

DMP 130 updates the database (step S230). In other words, DMP 130updates the database for any actions that occurred due to the capacitythreat. For example, as discussed previously, global partition 154 b oftablespace 140 b is used to remedy a capacity threat in tablespace 140a. DMP 130 updates database dictionary 122 and database table 124accordingly. For example, database dictionary 122 can be updated toindicate that global partition 154 b, due to the new information beingstored on within global partition 154 b, does not have enough free spaceto be allocated to other tablespaces to fulfill their capacity issues.For example, database table 124 is updated to indicate that globalpartition 154 b of tablespace 140 b is being used by and shared withtablespace 140 a to solve capacity issues. In an embodiment, informationcan be written to database logs (not shown) that will be picked up bymonitoring software (not shown), and this information is relayed tousers (e.g., database management professionals/experts/operators) sothey can plan and allocate space to the tablespace that ran out of freespace and had to borrow space from a global partition of anothertablespace. DMP 130 can then continue to monitor the database (stepS210).

If DMP 130 determines there is no capacity threat (decision block S215,no branch), DMP 130 determines if the percent free of local partition isabove a threshold (decision block S235). In other words, DMP 130determines the tablespaces that have, due to a capacity threat, hadinformation stored on a global partition of another tablespace. DMP 130then determines if those tablespaces have a percent free of their localpartition above a threshold. For example, DMP determines that tablespace140 a has information stored on global partition 154 b of tablespace 140b and that the percent free of local partition 150 a is fifty percent,and the threshold is thirty percent. If DMP 130 determines the percentfree of local partition is below a threshold (decision block S235, nobranch) DMP 130 continues to monitor database (step S210).

If DMP 130 determines the percent free of local partition is above athreshold (decision block S235, yes branch) DMP 130 reclaims informationto local partition (step S240). In other words, DMP 130 determines thereis enough free space above a threshold in a tablespace that informationthat couldn't be stored in that tablespace previously due to capacityissues and had to be stored in global partitions of other tablespacescan now be moved back to the local partition of the tablespace that hadthe capacity issues because the capacity issues do not exist anymore.For example, tablespace 140 a previously had capacity issues and had tostore some information on global partition 154 b of tablespace 140 b.Tablespace 140 a has freed up some space in local partition 150 a, andthe free space is now above the threshold. The information stored oftablespace 140 a that was stored on global partition 154 b of tablespace140 b is moved to local partition 150 a of tablespace 140 a. Once theinformation has been transferred, local bitmap 152 a and global bitmap156 b are updated accordingly.

The rate of transfer from global partitions to local partitions iscontrolled by DMP 130. DMP 130 will calculate the optimal rate oftransfer based on one or more of the following: bandwidth available, theload on tablespace 140 a and 140 b, database 120 and/or computer 110,and the behavior of the application or program that uses theinformation. The load on tablespace 140 a and 140 b, database 120 and/orcomputer 110 can include factors like CPU utilization, input/outputrequests, or memory utilization. For example, if the load is high thenthe transfer can be slow. Additionally, the rate of transfer can bemodified by the user, via user interface discussed previously. Forexample, the user can setup a threshold or parameter for all transfersor can determine a transfer rate on a case by case basis.

DMP 130 updates the database (step S245). In other words, DMP 130updates the database for any actions that occurred due reclaiminginformation to the local partition. For example, as discussedpreviously, information on global partition 154 b of tablespace 140 b ismoved to local partition 150 a of tablespace 140 a. DMP 130 updatesdatabase dictionary 122 and database table 124 accordingly. For example,database dictionary 122 can be updated to indicate that global partition154 b, due to the information being moved from global partition 154 b,does have enough free space to be allocated to other tablespaces tofulfill their capacity issues. For example, database table 124 isupdated to indicate that global partition 154 b of tablespace 140 b isnot being used by and shared with tablespace 140 a to solve capacityissues. In an embodiment, information can be written to database logs(not shown) that will be picked up by monitoring software (not shown)and this information is relayed to users (e.g., database managementprofessionals/experts/operators) so they can plan and allocate space tothe tablespace that not have free space and don't have to borrow spacefrom a global partition of another tablespace. DMP 130 can then continueto monitor the database (step S210).

FIG. 3 depicts computer 110 that is an example of a computing systemthat includes DMP 130. Computer 110 includes processors 301, cache 303,memory 302, persistent storage 305, communications unit 307,input/output (I/O) interface(s) 306 and communications fabric 304.Communications fabric 304 provides communications between cache 303,memory 302, persistent storage 305, communications unit 307, andinput/output (I/O) interface(s) 306. Communications fabric 304 can beimplemented with any architecture designed for passing data and/orcontrol information between processors (such as microprocessors,communications and network processors, etc.), system memory, peripheraldevices, and any other hardware components within a system. For example,communications fabric 304 can be implemented with one or more buses or acrossbar switch.

Memory 302 and persistent storage 305 are computer readable storagemedia. In this embodiment, memory 302 includes random access memory(RAM). In general, memory 302 can include any suitable volatile ornon-volatile computer readable storage media. Cache 303 is a fast memorythat enhances the performance of processors 301 by holding recentlyaccessed data, and data near recently accessed data, from memory 302.

Program instructions and data used to practice embodiments of thepresent invention may be stored in persistent storage 305 and in memory302 for execution by one or more of the respective processors 301 viacache 303. In an embodiment, persistent storage 305 includes a magnetichard disk drive. Alternatively, or in addition to a magnetic hard diskdrive, persistent storage 305 can include a solid state hard drive, asemiconductor storage device, read-only memory (ROM), erasableprogrammable read-only memory (EPROM), flash memory, or any othercomputer readable storage media that is capable of storing programinstructions or digital information.

The media used by persistent storage 305 may also be removable. Forexample, a removable hard drive may be used for persistent storage 305.Other examples include optical and magnetic disks, thumb drives, andsmart cards that are inserted into a drive for transfer onto anothercomputer readable storage medium that is also part of persistent storage305.

Communications unit 307, in these examples, provides for communicationswith other data processing systems or devices. In these examples,communications unit 307 includes one or more network interface cards.Communications unit 307 may provide communications through the use ofeither or both physical and wireless communications links. Programinstructions and data used to practice embodiments of the presentinvention may be downloaded to persistent storage 305 throughcommunications unit 307.

I/O interface(s) 306 allows for input and output of data with otherdevices that may be connected to each computer system. For example, I/Ointerface 306 may provide a connection to external devices 308 such as akeyboard, keypad, a touch screen, and/or some other suitable inputdevice. External devices 308 can also include portable computer readablestorage media such as, for example, thumb drives, portable optical ormagnetic disks, and memory cards. Software and data used to practiceembodiments of the present invention can be stored on such portablecomputer readable storage media and can be loaded onto persistentstorage 305 via I/O interface(s) 306. I/O interface(s) 306 also connectto display 309.

Display 309 provides a mechanism to display data to a user and may be,for example, a computer monitor.

The programs described herein are identified based upon the applicationfor which they are implemented in a specific embodiment of theinvention. However, it should be appreciated that any particular programnomenclature herein is used merely for convenience, and thus theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

The present invention may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the invention.The terminology used herein was chosen to best explain the principles ofthe embodiment, the practical application or technical improvement overtechnologies found in the marketplace, or to enable others of ordinaryskill in the art to understand the embodiments disclosed herein.

What is claimed is:
 1. A method for optimizing free space in a database,the method comprising the steps of: identifying, by one or more computerprocessors, a database, wherein the database has two or more tablespacesand wherein each tablespace of the two or more tablespaces includes alocal partition and a global partition, and wherein the global partitionof the two or more tablespaces are included in a global storage pool;receiving, by one or more computer processors, a request to move anobject to a first local partition of a first tablespace of the two ormore tablespaces; determining, by one or more computer processors, thata percentage of free space of the first tablespace is less than a firstpercentage threshold; responsive to determining that the percentage offree space of the first tablespace is less than the first percentagethreshold, determining, by one or more computer processors, a spacerequirement for the object; responsive to determining the spacerequirement for the object, determining, by one or more computerprocessors, at least one of the global partitions in the global storagepool that is available to store at least a portion of the object basedon the determined space requirement, space requirement for an overloadinformation, and the percent of space used in each tablespace; andstoring, by one or more computer processors, at least a portion of theobject in the determined at least one of the global partitions, whereinthe overload information comprises a size of space required to satisfysize requirements for objects in the tablespace where the object isstored, and the space requirement for the object is determined based onapplication specific architect decisions associated with the object,free space available in the tablespace where the object is stored, andgrowth predictions of the size requirements for objects in thetablespace where the object is stored.
 2. The method of claim 1, whereinstoring at least a portion of the object in the global storage poolcomprises: determining, by one or more computer processors, that anamount of used space of a first global partition of the first tablespaceis less than a second percentage threshold; responsive to determiningthat the amount of used space of the first global partition of the firsttablespace is less than a second percentage threshold, storing, by oneor more computer processors, at least a portion of the object in thefirst global partition of the first tablespace; and updating a globalbitmap of the global partition to correspond with the storing of the atleast a portion of the object to the first global partition.
 3. Themethod of claim 1, further comprising: determining, by one or morecomputer processors, that an amount of free space of the first localpartition is above a third percentage threshold; responsive todetermining the amount of free space of the first local partition isabove the third percentage threshold, moving, by one or more computerprocessors, at least a portion of the object stored in the determined atleast one of the global partitions to the first local partition; andupdating a global bitmap of the global partition and a local bitmap ofthe local partition to correspond with the moving of the at least aportion of the object to the first local partition.
 4. The method ofclaim 1, wherein each local partition of each tablespace of the two ormore tablespaces has a local bitmap associated with each local partitionthat includes information regarding space allocation of objects found inan associated local partition and each global partition of eachtablespace of the two or more tablespaces has a global bitmap associatedwith each global partition that includes information regarding spaceallocation of objects found in an associated global partition.
 5. Acomputer program product for optimizing free space in a database, thecomputer program product comprising: one or more computer readablestorage media; and program instructions stored on the one or morecomputer readable storage media, the program instructions comprising:program instructions to identify a database, wherein the database hastwo or more tablespaces and wherein each tablespace of the two or moretablespaces includes a local partition and a global partition, andwherein the global partition of the two or more tablespaces are includedin a global storage pool; program instructions to receive a request tomove an object to a first local partition of a first tablespace of thetwo or more tablespaces; program instructions to determine that apercentage of free space of the first tablespace is less than a firstpercentage threshold; program instructions, responsive to determiningthat the percentage of free space of the first tablespace is less thanthe first percentage threshold, to determine a space requirement for theobject; program instructions, responsive to determining the spacerequirement for the object, to determine at least one of the globalpartitions in the global storage pool that is available to store atleast a portion of the object based on the determined space requirement,space requirement for an overload information, and the percent of spaceused in each tablespace; and program instructions to store at least aportion of the object in the determined at least one of the globalpartitions, wherein the overload information comprises a size of spacerequired to satisfy size requirements for objects in the tablespacewhere the object is stored, and the space requirement for the object isdetermined based on application specific architect decisions associatedwith the object, free space available in the tablespace where the objectis stored, and growth predictions of the size requirements for objectsin the tablespace where the object is stored.
 6. The computer programproduct of claim 5, wherein the program instructions to store at least aportion of the object in the storage pool comprise: program instructionsto determine that an amount of used space of a first global partition ofthe first tablespace is less than a second percentage threshold; programinstructions, responsive to determining that the amount of used space ofthe first global partition of the first tablespace is less than thesecond percentage threshold, to store at least a portion of the objectin the first global partition of the first tablespace; and programinstructions to update a global bitmap of the global partition tocorrespond with the storing of the at least a portion of the object inthe first global partition.
 7. The computer program product of claim 5,further comprising program instructions, stored on the one or morecomputer readable storage media, to: determine that an amount of freespace of the first local partition is above a third percentagethreshold; responsive to determining the amount of free space of thefirst local partition is above the third percentage threshold, move atleast a portion of the object stored in the determined at least one ofthe global partitions to the first local partition; and update a globalbitmap of the global partition and a local bitmap of the local partitionto correspond with the moving of the at least a portion of the object tothe first local partition.
 8. The computer program product of claim 5,wherein each local partition of each tablespace of the two or moretablespaces has a local bitmap associated with each local partition thatincludes information regarding space allocation of objects found in anassociated local partition and each global partition of each tablespaceof the two or more tablespaces has a global bitmap associated with eachglobal partition that includes information regarding space allocation ofobjects found in an associated global partition.
 9. A computer systemfor optimizing free space in a database, the computer system comprising:one or more computer processors; one or more computer readable storagemedia; and program instructions, stored on the one or more computerreadable storage media for execution by at least one of the one or morecomputer processors, the program instructions comprising: programinstructions to identify a database, wherein the database has two ormore tablespaces and wherein each tablespace of the two or moretablespaces includes a local partition and a global partition, andwherein the global partition of the two or more tablespaces are includedin a global storage pool; program instructions to receive a request tomove an object to a first local partition of a first tablespace of thetwo or more tablespaces; program instructions to determine that apercentage of free space of the first tablespace is less than a firstpercentage threshold; program instructions, responsive to determiningthat the percentage of free space of the first tablespace is less thanthe first percentage threshold, to determine a space requirement for theobject; program instructions, responsive to determining the spacerequirement for the object, to determine at least one of the globalpartitions in the global storage pool that is available to store atleast a portion of the object based on the determined space requirement,space requirement for an overload information, and the percent of spaceused in each tablespace; and program instructions to store at least aportion of the object in the determined at least one of the globalpartitions, wherein the overload information comprises a size of spacerequired to satisfy size requirements for objects in the tablespacewhere the object is stored, and the space requirement for the object isdetermined based on application specific architect decisions associatedwith the object, free space available in the tablespace where the objectis stored, and growth predictions of the size requirements for objectsin the tablespace where the object is stored.
 10. The computer system ofclaim 9, wherein the program instructions to store at least a portion ofthe object in the global storage pool comprises: program instructions todetermine that an amount of used space of a first global partition ofthe first tablespace is less than a second percentage threshold; programinstructions, responsive to determining that the amount of used space ofthe first global partition of the first tablespace is less than thesecond percentage threshold, to store at least a portion of the objectin the first global partition of the first tablespace; and programinstructions to update a global bitmap of the global partition tocorrespond with the storing of the at least a portion of the object inthe first global partition.
 11. The computer system of claim 9, furthercomprising program instructions, stored on the one or more computerreadable storage media for execution by at least one of the one or morecomputer processors, to: determine that an amount of free space of thefirst local partition is above a third percentage threshold; responsiveto determining the amount of free space of the first local partition isabove the third percentage threshold, move at least a portion of theobject stored in the determined at least one of the global partitions tothe first local partition; and update a global bitmap of the globalpartition and a local bitmap of the local partition to correspond withthe moving of the at least a portion of the object to the first localpartition.
 12. The computer system of claim 9, wherein each localpartition of each tablespace of the two or more tablespaces has a localbitmap associated with each local partition that includes informationregarding space allocation of objects found in an associated localpartition and each global partition of each tablespace of the two ormore tablespaces has a global bitmap associated with each globalpartition that includes information regarding space allocation ofobjects found in an associated global partition.